<html>
<head>
    @include('v1.common.meta')
    <link rel="stylesheet" href="{{elixir('css/basicdata.css')}}">
</head>
<body>
<div class="yjs-grid">
    <div class="yjs-grid-box">
        <div class="layui-tab">
            @if(Auth::check())
                <div class="layui-container">
                    @if($view==='deleteData')
                        {{--单条删除视图--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <fieldset class="layui-elem-field">
                                    <legend>删除【{{$itemData['name']}}】信息</legend>
                                    <div class="layui-field-box">
                                        <div class="layui-row hidden-tips">
                                            <div class="layui-col-md12">
                                                <blockquote class="layui-elem-quote">
                                                    温馨提示：考虑到相关数据关联关系，删除数据之前，请为存在"<i class="layui-icon">&#xe605;</i>"标识的表单项，创建数据转换规则后，方可进行数据删除操作。
                                                </blockquote>
                                            </div>
                                        </div>
                                        <div class="layui-form layui-form-pane" name="departmentForm"
                                             action="javascript:;" method="POST">
                                            <input type="hidden" name="viewType" value="{{$view}}">
                                            <input type="hidden" name="code" value="{{$itemData['code']}}">
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">原部门</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['name']}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label"><i
                                                                    class="layui-icon">&#xe605;</i>现部门</label>
                                                        <div class="layui-input-inline">
                                                            <select name="newcode"
                                                                    lay-filter="parentSel" lay-verify="required"
                                                                    lay-search="">
                                                                <option value="">直接选择或搜索选择</option>
                                                                @foreach($departmentList as $parent)
                                                                    @if($parent["code"]===$itemData['code'])
                                                                        <option value="{{$parent["code"]}}"
                                                                                disabled>{{$parent["name"]}}</option>
                                                                    @else
                                                                        <option value="{{$parent["code"]}}">{{$parent["name"]}}</option>
                                                                    @endif
                                                                @endforeach
                                                            </select>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">验证码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" name="captcha" maxlength="4"
                                                                   lay-verify="required"
                                                                   placeholder="请输入图片验证码" autocomplete="off"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md3">
                                                    <div class="layui-form-item">
                                                        <img class="getLVcode" src="{{ captcha_src('mini') }}"
                                                             width="70px"
                                                             height="34px" style="border: 1px solid green;"/>
                                                        <div class="layui-form-mid layui-word-aux">
                                                            点击图片刷新验证码
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md3">
                                                    {{--隐藏提交--}}
                                                    <button id="toolbarSubmit" type="submit" class="layui-btn"
                                                            lay-filter="toolbarEvent" lay-submit style="display: none;">
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    @elseif($view==='deleteBatchData')
                        {{--批量删除视图--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <fieldset class="layui-elem-field">
                                    <legend>删除【{{$itemCount}}】条部门信息</legend>
                                    <div class="layui-field-box">
                                        <div class="layui-row hidden-tips">
                                            <div class="layui-col-md12">
                                                <blockquote class="layui-elem-quote">
                                                    温馨提示：考虑到相关数据关联关系，删除数据之前，请为存在"<i class="layui-icon">&#xe605;</i>"标识的表单项，创建数据转换规则后，方可进行数据删除操作。
                                                </blockquote>
                                            </div>
                                        </div>
                                        <div class="layui-form layui-form-pane" name="departmentForm"
                                             action="javascript:;" method="POST">
                                            <input type="hidden" name="viewType" value="{{$view}}">
                                            <input type="hidden" name="code" value="{{$code}}">
                                            @foreach($itemData as $item)
                                                <div class="layui-row">
                                                    <div class="layui-col-md6">
                                                        <div class="layui-form-item">
                                                            <label class="layui-form-label">原部门</label>
                                                            <div class="layui-input-inline">
                                                                <input type="text" value="{{$item['name']}}" disabled
                                                                       class="layui-input">
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="layui-col-md6">
                                                        <div class="layui-form-item">
                                                            <label class="layui-form-label"><i
                                                                        class="layui-icon">&#xe605;</i>现部门</label>
                                                            <div class="layui-input-inline">
                                                                <select name="nc{{$item['code']}}" lay-filter="parentSel" lay-verify="required"
                                                                        lay-search="">
                                                                    <option value="">直接选择或搜索选择</option>
                                                                    @foreach($departmentList as $parent)
                                                                        @if($parent["code"]===$item['code'])
                                                                            <option value="{{$parent["code"]}}"
                                                                                    disabled>{{$parent["name"]}}</option>
                                                                        @else
                                                                            <option value="{{$parent["code"]}}">{{$parent["name"]}}</option>
                                                                        @endif
                                                                    @endforeach
                                                                </select>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            @endforeach
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">验证码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" name="captcha" maxlength="4"
                                                                   lay-verify="required"
                                                                   placeholder="请输入图片验证码" autocomplete="off"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md3">
                                                    <div class="layui-form-item">
                                                        <img class="getLVcode" src="{{ captcha_src('mini') }}"
                                                             width="70px"
                                                             height="34px" style="border: 1px solid green;"/>
                                                        <div class="layui-form-mid layui-word-aux">
                                                            点击图片刷新验证码
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md3">
                                                    {{--隐藏提交--}}
                                                    <button id="toolbarSubmit" type="submit" class="layui-btn"
                                                            lay-filter="toolbarEvent" lay-submit style="display: none;">
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    @else
                        {{--视图类型不正确--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <blockquote class="layui-elem-quote-error">
                                    友情提示：视图类型不正确，无法支持后续操作。
                                </blockquote>
                            </div>
                        </div>
                    @endif
                </div>
            @else
                <div class="layui-container">
                    <div class="layui-row">
                        <div class="layui-col-md12">
                            <blockquote class="layui-elem-quote-error">
                                友情提示：该功能只面向已成功登录系统，并具有相应权限的用户可用。
                            </blockquote>
                        </div>
                    </div>
                </div>
            @endif
        </div>
    </div>
</div>

@include('v1.common.js')
<script src="{{elixir('js/departmentOperate.js')}}"></script>
</body>
<script type="text/html">
    <input type="hidden" id="rspStatus" value="">
    <input type="hidden" id="rspMsg" value="">
</script>
</html>